'use strict';

module.exports = app => {
    const { STRING, INTEGER, DATE, DOUBLE } = app.Sequelize;

    const Weight = app.model.define('Weight', {
        id: { type: INTEGER, primaryKey: true, autoIncrement: true },
        report_id: {
            type: STRING(150),
            defaultValue: null,
            allowNull: true
        },
        term_id: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        systemCode: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        disposeUnitCode: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        weightNo: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        no: {
            type: INTEGER,
            defaultValue: null,
            allowNull: true
        },
        carNo: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        grossTime: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        tareTime: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        grossWeight: {
            type: INTEGER,
            defaultValue: null,
            allowNull: true
        },
        tareWeight: {
            type: INTEGER,
            defaultValue: null,
            allowNull: true
        },
        netWeight: {
            type: INTEGER,
            defaultValue: null,
            allowNull: true
        },
        productName: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        icCode: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        sourceUnit: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        transportUnit: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        handleUnit: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        memo: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        str1: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        status: {
            type: INTEGER,
            defaultValue: null,
            allowNull: true
        },
        result: {
            type: STRING(150),
            defaultValue: null,
            allowNull: true
        },
        flag: {
            type: STRING(50),
            defaultValue: 'init',
            allowNull: true
        },
        reporttime: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        },
        deletetime: {
            type: STRING(50),
            defaultValue: null,
            allowNull: true
        }
    }, {
        tableName: 'Weight',
        underscored: false,
        timestamp: false,  // 是否需要增加createdAt、updatedAt、deletedAt字段
        updatedAt: false, // 不想要 updatedAt
        createdAt: false
    });

    return Weight;
};
